<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<s:head theme="ajax" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>공통코드관리</title>
	<link rel="stylesheet" type="text/css" href="/inc/css/common.css" />
	<script type="text/javascript" src="/inc/js/common.js"></script>
	
	<script type="text/javascript">
		//공통코드추가
		function addCommonCode() {

			width 	= 550;
			height 	= 165;

			var x = fnc_center_x(width) , y = fnc_center_y(height);
			 
			var uri		=	"attendAddCommonCodePopup.action";
			var	nm		=	"popup";
			var attr    =   "left = "+x+" , top="+y+" , width="+width+" , height="+height+" , ScrollBars=no , status=no , ,menubar=no";   //window size
			
			window.open(uri , nm , attr);
		
			return false;
			
		}
		
		//공통코드수정
		function modifyCommonCode(table) {
			
			width 	= 550;
			height 	= 210;
			x 		= 350;
			y 		= 200;
		
			scrollOption = "no";
			
			var url = "attendCommonCodePopup.action?table="+table;
	
			window.open( url,	"form_pop",	"left="	+ x + ",top=" + y	+ ",width="	+ width + ",height=" + height	+ ",ScrollBars="+scrollOption+",status=yes,menubar=no");	
			
		}

		//공통코드 삭제
		function deleteCommonCode() {
		
			var size= document.getElementsByName("checkSelect").length;
			var cnt = 0;
			
			for(i=0;i < size;i++) {
				if(size >0) {
					if (document.getElementsByName("checkSelect")[i].checked == true) {
						cnt++;
					}
				}else{
					if (document.getElementsByName("checkSelect").checked == true) {
						cnt++;
					}
				}
			}
			
			if(cnt ==0) {
				alert("<s:text name="alert.message.deleteCode" />");
				return false;
			}else{
				if (!confirm("<s:text name="alert.message.questionDelete" />")) {
					return false;
				}
				list_fm.action ="attendDeleteCommonCode.action";
				list_fm.submit();
			}
		}	

		//하위코드 추가
		function addSubCommonCode() {
			
			width = 550;
			height = 208;

			var x = fnc_center_x(width) , y = fnc_center_y(height);
			
			scrollOption = "no";
			
			window.open("",	"popup2",	"left="	+ x + ",top=" + y	+ ",width="	+ width + ",height=" + height	+ ",ScrollBars="+scrollOption+",status=yes,menubar=no");
			var f	=	document.getElementById("form");
			f.target = "popup2";
			f.action = "attendAddSubCommonCode.action";
			f.submit();

			return false;
		}

		//ajax로 조회리스트 호출.
	    function call_dojo() {
	    	dojo.event.topic.publish("ajax_list");
	    }

		//popup 정가운데 띄우기
		function fnc_center_x(w) {
	      	var x;
			x =  (screen.availWidth - w) / 2;
	      	return x;
		}
		
	 	//popup 정가운데 띄우기
		function fnc_center_y(h) {
	      	var y;
			y =  (screen.availHeight - h) / 2;
	      	return y;
		}

		function selectCode(){
			$("#code_name").css({backgroundColor:'#3366FF',color:'#FFFFFF'});
    		if($("#code_name").val() == "all"){
                $("#code_name").css({backgroundColor:'#ffffff',color:'#656464'});
	    		}
    		return false;
          
		}
	    
	</script>
	
</head>
<body>
<!--------- Contants Range : STR--------------->
	<div class="fl_ri">
		<div id="contants_box">
			<div id="tit">
				<span class="fl_ri tit_navi">Home &gt; 관리자 &gt; <span class="f_b">공통코드관리</span></span>
				<div class="fl_le"><img src="/images/tit_menu05_img05.gif" /></div>
			</div>
		
			<s:form name="form"  theme="simple" method="post" id="form">
			<s:hidden id="cur_page" name="cur_page"/>    <!-- 현재페이지 -->
			<!----------Search_Box : STR ---------->
			<div id="search03">
				<div id="search_box03">
					<ul>
						<li class="txt">대표코드</li>
						<li class="input">
							<s:select name="checkedGroupCode" id="code_name" headerKey="all" headerValue="::전체::" list="listGroupCode" listKey="group_cd" listValue="group_code_nm" cssClass="combobox105se" onchange="return selectCode()"/>							
						</li>
						<li class="txt01">코드명</li>
						<li class="input">
							<input type="text" name="full_nm" id="full_nm" class="input_120se" value='<s:property value="full_nm" />' onkeypress="if(event.keyCode == '13'){call_dojo(); return false;}" maxlength="3" />
						</li>
					</ul>
					<ul class="btn">
						<li>
							<span class="fl_ri">
							<s:submit type="image" src="/images/btn_search04.gif"  	value="조회"				title="조회"			onclick="return getList('search')"/> 
							<s:submit type="image" src="/images/btn_dcod.gif" 	    value="대표코드 추가" 		title="대표코드 추가"	onclick="return addCommonCode()" />	
							<s:submit type="image" src="/images/btn_bcod.gif" 		value="하위코드 추가" 		title="하위코드 추가" 	cssClass="img_tm" onclick="return addSubCommonCode()" />
							</span>
						</li>
					</ul>
				</div>
			</div>
			<!----------Search_Box : END ---------->
			</s:form>
			<s:url id="no_url" action="attendSearchCommonCode" />
			<s:div showLoadingText="false" href="%{no_url}"  theme="ajax" listenTopics="ajax_list" formId="form" executeScripts="true" />			
		</div>
	</div>
	<!--------- Contants Range : END--------------->
</body>
</html>
